package archive

import (
	"fmt"

	"github.com/gogf/gf/v2/text/gstr"
)

type Gzip struct{}

func (r *Gzip) Archive(source []string, destination string) error {
	fmt.Printf("gzip archive\n")
	fmt.Printf("source: %s\n", gstr.Implode(" ", source))
	fmt.Printf("destination: %s\n", destination)
	return nil
}

func (r *Gzip) Extract(source string, destination []string) error {
	fmt.Printf("gzip extract\n")
	fmt.Printf("source: %s\n", source)
	fmt.Printf("destination: %s\n", gstr.Implode(" ", destination))
	return nil
}

//func (receiver *archiveGz) TarReader(source string) (io.Reader, error) {
//	fileReader, err := os.Open(source)
//	if err != nil {
//		return nil, err
//	}
//	defer fileReader.Close()
//
//	xzReader, err := gzip.NewReader(fileReader)
//	if err != nil {
//		return nil, err
//	}
//
//	return tar.NewReader(xzReader), nil
//}
//func (receiver *archiveGz) TarWriter(target string) (io.Writer, error) {
//	fileWriter, err := os.Create(target)
//	if err != nil {
//		return nil, err
//	}
//	defer fileWriter.Close()
//
//	gzWriter := gzip.NewWriter(fileWriter)
//
//	return tar.NewWriter(gzWriter), nil
//}
